#include <QApplication>
#include <QTranslator>
#include <QMessageBox>
#include <QAction>
#include <QDir>
#include <QFileDialog>
#include <QLineEdit>
#include <iostream>

#include "EqualizeWindow.h"

void EqualizeWindow::windowSize()
{
	setMinimumSize(EqualizeWindow::winWidth, EqualizeWindow::winHeight);
	resize(EqualizeWindow::winWidth, EqualizeWindow::winHeight);
	setWindowTitle(tr("Equalizer"));
}


EqualizeWindow::EqualizeWindow(SoundObj *so, QMainWindow *parent):QDialog(parent),soundObj(so)
{
	mainLayout = new QVBoxLayout();

	slidersLayout = new QHBoxLayout();

	sliderLayout = new QVBoxLayout * [nbrSlider];
	sliders = new QSlider * [nbrSlider];
	labels  = new QLabel  * [nbrSlider];

	for (long i=0; i<nbrSlider; i++)
	{
		labels[i] = new QLabel(QString::number(defaultValue));

		sliderLayout[i] = new QVBoxLayout();

		sliders[i] = new QSlider(Qt::Vertical);
		sliders[i]->setMinimum(minFactor);
		sliders[i]->setMaximum(maxFactor);
		sliders[i]->setValue(defaultValue);
		sliders[i]->setPageStep(10);
	    sliders[i]->setFocusPolicy(Qt::StrongFocus);
	    sliders[i]->setTickPosition(QSlider::TicksLeft);
	    sliders[i]->setTickInterval(10);
	    sliders[i]->setSingleStep(10);

	    connect(sliders[i], SIGNAL(valueChanged(int)), labels[i], SLOT(setNum(int)));
	    connect(sliders[i], SIGNAL(valueChanged(int)), this, SLOT(upDateEqualizer(int)));

		sliderLayout[i]->addWidget(sliders[i]);
		sliderLayout[i]->addWidget(labels[i]);

		slidersLayout->addItem(sliderLayout[i]);
	}

	buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
	connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
	connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

	mainLayout->addLayout(slidersLayout);
	mainLayout->addWidget(buttonBox);

	setLayout(mainLayout);
}

void EqualizeWindow::accept()
{
}

void EqualizeWindow::upDateEqualizer(int val)
{
}

EqualizeWindow::~EqualizeWindow(){}
